* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*   Regressions of trends by time and age-revisions 
*        9/10/21
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

use "AdsEmploymentMerged.dta", clear  


* By Age Group
cap drop yscat
egen yscat= cut(asker_age), group(10) label
table asker_age yscat

cap drop agr*
gen agr1=1 if asker_age>=17 & asker_age<=22
gen agr2=1 if asker_age>=23 & asker_age<=24
gen agr3=1 if asker_age>=25 & asker_age<=25
gen agr4=1 if asker_age>=26 & asker_age<=27
gen agr5=1 if asker_age>=28 & asker_age<=28
gen agr6=1 if asker_age>=29 & asker_age<=29
gen agr7=1 if asker_age>=30 & asker_age<=31
gen agr8=1 if asker_age>=32 & asker_age<=34
gen agr9=1 if asker_age>=35 & asker_age<=39
gen agr10=1 if asker_age>=40 

for varlist agr1-agr10: replace X=0 if X==. & asker_age~=.

la var agr1 "17-22"
la var agr2 "23-24"
la var agr3 "25-25"
la var agr4 "26-27"
la var agr5 "28-28"
la var agr6 "29-29"
la var agr7 "30-31"
la var agr8 "32-34"
la var agr9 "35-39"
la var agr10 "40-60"


* %%%% Wanted Traits %%%%
* %%%% Table 2, Panel A %%%%
  
estimates clear
reg anyoccwanted i.year##i.askermale ///
 if asker_age<50  , vce(cluster date)
 
estimates store e1   
 
reg anyoccwanted i.year##i.askermale  ///
  if adplacedby~="family" & asker_age<50 , vce(cluster date)  

estimates store e4 

reg anyoccwanted i.year##i.askermale  ///
  if anyforeignself==1 & asker_age<50 , vce(cluster date)
  
estimates store e5

* Looks

reg anylookswanted i.year##i.askermale ///
 if asker_age<50  , vce(cluster date)
  
estimates store e6   

reg anylookswanted i.year##i.askermale  ///
  if adplacedby~="family"  & asker_age<50, vce(cluster date)
  
estimates store e8 
  
reg anylookswanted i.year##i.askermale  ///
  if anyforeignself==1 & asker_age<50, vce(cluster date)

estimates store e9


esttab e1 e4 e5 e6 e8 e9 


* %%%% Own Traits %%%%
* %%%% Table 2, Panel B %%%%

estimates clear
reg anyoccself i.year##i.askermale ///
  , vce(cluster date)

estimates store e1   

reg anyoccself i.year##i.askermale   ///
	 if adplacedby~="family" & asker_age<50, vce(cluster date)
  
estimates store e4 
  
reg anyoccself i.year##i.askermale  ///
if anyforeignself==1 & asker_age<50, vce(cluster date)

estimates store e5

* Looks

reg anylooksself i.year##i.askermale ///
  , vce(cluster date)
  
estimates store e6   
 
reg anylooksself i.year##i.askermale  ///
	if adplacedby~="family", vce(cluster date)
  
estimates store e8 
  
reg anylooksself i.year##i.askermale ///
	if anyforeignself==1, vce(cluster date)

estimates store e9


esttab e1 e4 e5 e6 e8 e9 
	 
* %%%%%% Wanted Traits, 1990-2000 and 1985-1990 separately %%%%%%%
* %%%%%%%%% Table A2 %%%%%%%%%
  
estimates clear
 
reg anyoccwanted i.year##i.askermale ///
 if asker_age<50 & year<1990 , vce(cluster date)
 
estimates store e1   
 
reg anyoccwanted i.year##i.askermale ///
 if asker_age<50 & year>=1990 , vce(cluster date)
estimates store e2  
 
 
reg anylookswanted i.year##i.askermale ///
 if asker_age<50 & year<1990 , vce(cluster date)
 
estimates store e3  
 
reg anylookswanted i.year##i.askermale ///
 if asker_age<50 & year>=1990 , vce(cluster date)
estimates store e4  

* Self

reg anyoccself i.year##i.askermale ///
 if asker_age<50 & year<1990 , vce(cluster date)
 
estimates store e5  
 
reg anyoccself i.year##i.askermale ///
 if asker_age<50 & year>=1990 , vce(cluster date)
estimates store e6  
 
 
reg anylooksself i.year##i.askermale ///
 if asker_age<50 & year<1990 , vce(cluster date)
 
estimates store e7  
 
reg anylooksself i.year##i.askermale ///
 if asker_age<50 & year>=1990 , vce(cluster date)
 
estimates store e8 


esttab e1 e2 e3 e4 e5 e6 e7 e8 

* %%%%%% Own Traits, 1990-2000 and 1985-1990 separately %%%%%%%
* %%%%%%%%% Table A2 %%%%%%%%%

estimates clear
reg anyoccself i.year##i.askermale ///
  , vce(cluster date)

estimates store e1   

reg anyoccself i.year##i.askermale   ///
	 if adplacedby~="family" & asker_age<50, vce(cluster date)
  
estimates store e4 
  
reg anyoccself i.year##i.askermale  ///
if anyforeignself==1 & asker_age<50, vce(cluster date)

estimates store e5

* Looks

reg anylooksself i.year##i.askermale ///
  , vce(cluster date)
  
estimates store e6   
 
reg anylooksself i.year##i.askermale  ///
	if adplacedby~="family", vce(cluster date)
  
estimates store e8 
  
reg anylooksself i.year##i.askermale ///
	if anyforeignself==1, vce(cluster date)

estimates store e9


esttab e1 e4 e5 e6 e8 e9 
	 
